package net.stogi.unicore.beyond.ui.client;

import net.stogi.common.gwt.dispatch.client.core.ActionManager;
import net.stogi.common.gwt.dispatch.client.core.impl.ActionManagerImpl;
import net.stogi.common.gwt.frame.client.core.ApplicationManager;
import net.stogi.common.gwt.frame.client.core.CacheManager;
import net.stogi.common.gwt.frame.client.core.EventBus;
import net.stogi.common.gwt.frame.client.core.LayoutManager;
import net.stogi.common.gwt.frame.client.core.impl.BasicCacheManagerImpl;
import net.stogi.common.gwt.frame.client.core.impl.EventBusImpl;
import net.stogi.common.gwt.frame.client.module.ModuleFactoryRegistry;
import net.stogi.common.gwt.frame.client.module.impl.BasicModuleFactoryRegistry;

import com.google.gwt.core.client.EntryPoint;

public class UnicoreBeyondUi implements EntryPoint {

	@Override
	public void onModuleLoad() {
		// Manager responsible for executing actions to the server side.
		final ActionManager actionManager = new ActionManagerImpl();
		// Manager responsible for simple caching on the client side.
		final CacheManager cacheManager = new BasicCacheManagerImpl();
		// Component responsible for broadcasting application events.
		final EventBus eventBus = new EventBusImpl();
		// Manager responsible for handling layout of application.
		final LayoutManager layoutManager = new UnicoreBeyondUiLayoutManagerImpl();
		// Registry for keeping all application module factories.
		final ModuleFactoryRegistry moduleFactoryRegistry = new BasicModuleFactoryRegistry();
		// Main application manager responsible for batch start of application.
		final ApplicationManager applicationManager = new UnicoreBeyondUiApplicationManagerImpl(actionManager, cacheManager,
				eventBus, layoutManager, moduleFactoryRegistry);

		applicationManager.run();
	}
}
